package cn.com.rabitClient;

import java.util.Date;

import org.springframework.amqp.core.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.context.annotation.Bean;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.stereotype.Component;


/**
 * @author liufl E-mail:Huberier@allpyra.com
 * @version 创建时间：2017年7月31日 上午11:46:08
 * 类说明
 */
@Component  
@RabbitListener(queues = "mqqueue")  
@EnableScheduling  
public class Reciever {  
  
      
    @Bean  
    public Sender mySender() {  
        return new Sender();  
    }  
  
    @Bean  
    public Queue fooQueue() {  
        return new Queue("mqqueue");  
    }  
  
      
    @RabbitHandler  
    public void process(@Payload String foo) {  
        System.out.println(new Date() + "==== :" + foo);  
    }  
  
      
}  